﻿@model IEnumerable<IniTechCaash.WebApplication.Models.FinanceAccountDetailsViewModel>

@{
    ViewBag.Title = "Index";
}

<h2>Chart of Accounts</h2>

<p>
    @if (User.IsInRole("Admin"))
    {
        @Html.ActionLink("Create New", "Create", null, new { @class="btn-default btn" })
    }
</p>
<table class="table">
    <tr>
        <th>
            Id
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th class="text-right">
            @Html.DisplayNameFor(model => model.Balance)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.IsEnabled)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.LastModifiedDate)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink(String.Join("-", item.Descriptive, item.Number), "Details", new { id = item.Id})
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td class="text-right">
            @item.Balance.ToString("#,#.00#;(#,#.00#);0.00")
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.IsEnabled)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastModifiedDate)
        </td>
    </tr>
}
</table>
